<template>
    <el-form :model="form" label-width="auto" :inline="true">
        <div>
            <el-form-item label="断奶日期" style="width: 500px;">
                <el-col :span="11">
                    <el-date-picker v-model="form.weanedDate" type="date" placeholder="请选择" style="width: 100%" />
                </el-col>
                <el-col :span="11">
                    <el-date-picker v-model="form.jDate" type="date" placeholder="请选择" style="width: 100%" />
                </el-col>
            </el-form-item>
            <el-form-item label="羔羊耳号" style="width: 200px;">
                <el-select v-model="form.breedingSheepArchiveId" placeholder="请选择">
                    <el-option v-for="a in bugles" :label="a.auricle" :value="a.breedingSheepArchiveId" />
                </el-select>
            </el-form-item>
            <el-form-item label="哺乳种母耳号" style="width: 200px;">
                <el-input v-model="form.breedingBugles" />
            </el-form-item>
        </div>
    </el-form>

    <el-button type="success" @click="getlist()">查询</el-button>
    <el-table :data="list" style="width: 100%">
        <el-table-column prop="lambId" label="序号" />
        <el-table-column prop="auricle" label="羔羊耳号" />
        <el-table-column prop="sheepAge" label="断奶日龄" />
        <el-table-column prop="heavy" label="断奶重(公斤)" />
        <el-table-column prop="breedingBugles" label="哺乳种母耳号" />
        <el-table-column prop="parity" label="胎次" />
        <el-table-column prop="buildingName" label="断奶栋舍" />
        <el-table-column prop="columnsName" label="断奶栏位" />
        <el-table-column prop="bEnter" label="转入栋舍" />
        <el-table-column prop="cEnter" label="转入栏位" />
        <el-table-column prop="weanedDate" label="断奶日期">
            <template v-slot="scope">
                {{ scope.row.weanedDate.substring(0, 10) }}
            </template>
        </el-table-column>
    </el-table>
</template>
<script setup lang="ts">
import { reactive, ref, onMounted } from 'vue'
import axios from 'axios';
const form = reactive({
    weanedDate: "",
    jDate: "",
    breedingSheepArchiveId: "",
    breedingBugles: ""

})

//转出栋舍

//栋舍类型
const building = ref([])
const getbuilding = () => {
    axios.post("http://localhost:5012/api/Buildings/BuildingTypeBind", {}).then(res => {
        console.log(res)
        building.value = res.data.data
    })
}
//耳号下拉框
const bugles = ref([])
const getsheepvariety = () => {
    axios.post("http://localhost:5012/api/SheepFile/BasicInformationList", {}).then(res => {
        console.log(res)
        bugles.value = res.data.data
    })
}
const list = ref([])
const getlist = () => {
    axios.post("http://localhost:5012/api/Prompt/LambWeaningList", {
        weanedDate: form.weanedDate,
        jDate: form.jDate,
        breedingSheepArchiveId: form.breedingSheepArchiveId || 0,
        breedingBugles: form.breedingBugles
    }).then(res => {
        list.value = res.data.data
    })
}
onMounted(() => {
    getlist()
    getsheepvariety()
    getbuilding()
})
</script>